Locations

Lakes

lakes <- fread('../data/metadata/lakes.csv')

Weather Stations

stations <- fread('../data/weather/wu_stations.csv')

Sample Metadata

metadata_legend <- data.table::fread('../data/metadata/metadata_legend.csv')

2018

metadata_2018 <- data.table::fread('../data/metadata/2018.csv')

Download

2019

metadata_2019 <- data.table::fread('../data/metadata/2019.csv')

Download

2020

metadata_2020 <- data.table::fread('../data/metadata/2020.csv')

Download

All

metadata <- rbind(metadata_2018, metadata_2019)
set(metadata, j = "Date", value = as.Date(metadata$Date, "%m/%d/%Y"))
set(metadata, j = "Year", value = factor(metadata$Year, levels = sort(unique(metadata$Year))))
set(metadata, j = "Week", value = factor(metadata$Week, levels = sort(unique(metadata$Week))))
setorder(metadata, Location, Year, Week)

Risk Levels

metadata[, Risk := "No"]
data.table::set(metadata, which(metadata$Microcystin >= 0.1), "Risk", "Low")
data.table::set(metadata, which(metadata$Microcystin >= 10), "Risk", "Moderate")
data.table::set(metadata, which(metadata$Microcystin >= 20), "Risk", "High")
lake_risk <- rep("#33A02C", length(unique(metadata$Location)))
lake_risk[metadata[, any(Risk %in% "Low"), by = Location]$V1] <- "#FFD92F"
lake_risk[metadata[, any(Risk %in% "Moderate"), by = Location]$V1] <- "#FC8D62"
lake_risk[metadata[, any(Risk %in% "High"), by = Location]$V1] <- "red"

Read Counts

ASV Table

read_counts <- construct_ASVtable('../data/16S_processing/finalized_reads')
read_counts <- read_counts[, c(TRUE, colSums(read_counts[,-1]) > 5000), with = FALSE]
data.table::setnames(read_counts, colnames(read_counts), gsub('_S.*', '', colnames(read_counts)))

Download

Classifications

classifications <- dada2::assignTaxonomy(read_counts[[1]], '../data/16S_processing/databases/rdp_train_set_18.fa.gz')
classifications <- dada2::assignTaxonomy(read_counts[[1]], '../data/16S_processing/databases/silva_nr99_v138.1_train_set.fa.gz')

Download

Weather

weather <- readRDS('../data/weather/weather.RDS')

set(weather, weather[, .I[Station == "KIAMANSO3" &Date == "2019-08-06"]], 
    names(weather)[-c(1:3)], 
    weather[weather[, .I[Station == "KIAODEBO3" & Date == "2019-08-06"]],- c(1:3)])

station = "KIAMYSTI2"
date = lubridate::as_date("2018-08-08")
paste0('https://www.wunderground.com/dashboard/pws/', station, '/table/', date, '/', date, '/daily')
## [1] "https://www.wunderground.com/dashboard/pws/KIAMYSTI2/table/2018-08-08/2018-08-08/daily"
set(weather, 193L, names(weather), value = list("Crandall’s Beach", "KIASPIRI1", as.Date("2018-07-03"), 
                                                80, 86.7, 68.5, 
                                                77, 87, 67, 
                                                72, 76, 64,
                                                6.2, 13, 0,
                                                12.9, 21,
                                                0, 29.96, 29.86))
set(weather, 330L, names(weather), value = list("Green Valley Beach", "KIACREST15", as.Date("2019-07-17"),
                                                81.55, 92.7, 71.50,
                                                82.51, 92, 72,
                                                75.53, 82.40, 64,
                                                5.54, 12.70, 0,
                                                6.86, 15.60,
                                                0, 30.05, 29.92))
set(weather, 572L, names(weather), value = list("Lake Manawa Beach", "KNEBELLE19", as.Date("2018-07-24"), 
                                                75.06, 85.80, 47, 
                                                62.92, 92, 38,
                                                60.34, 65.30, 34.90, 
                                                1.25, 21.60, 0, 
                                                5.02, 83.20,
                                                0, 30.17, 30.10))
set(weather, 602L, names(weather), value = list("Lake Wapello Beach", "KIAMYSTI2", as.Date("2018-07-25"), 
                                                73.2, 86.5, 57.7,
                                                69, 45, 96,
                                                61.5, 67.1, 55.8,
                                                1.5, 9, 0,
                                                10, 2.7,
                                                0, 30.09, 29.92))
set(weather, 604L, names(weather), value = list("Lake Wapello Beach", "KIAMYSTI2", as.Date("2018-08-08"), 
                                                75.11, 89.90, 60.10,
                                                71.40, 98, 42,
                                                63.56, 68.30, 59.20,
                                                1.31, 6.60, 0,
                                                2.55, 9.80,
                                                0.01, 30, 29.90))
set(weather, 606L, names(weather), value = list("Lake Wapello Beach", "KIAMYSTI2", as.Date("2018-08-20"), 
                                                71.90, 76.10, 68.40,
                                                88.14, 96, 73,
                                                68.09, 70.20, 66.70,
                                                1.4, 5, 0,
                                                6.2, 12,
                                                0.28, 29.81, 29.61))
set(weather, 608L, names(weather), value = list("Lake Wapello Beach", "KIAMORAV3", as.Date("2018-05-30"), 
                                                72.56, 83.10, 62.40,
                                                72.62, 91, 56,
                                                65.37, 68.90, 59,
                                                4.23, 18, 0,
                                                11.20, 29.75,
                                                0.02, 29.76, 0))
set(weather, 664L, names(weather), value = list("Lewis and Clark (Blue Lake) Beach", "KIAWHITI3", as.Date("2018-08-07"), 
                                                70.94, 82.60, 33.70,
                                                73.53, 91, 42,
                                                63.92, 69.50, 59.20,
                                                2.43, 11, 0,
                                                0.1, 18,
                                                0.1, 29.99, 29.90))
set(weather, 669L, names(weather), value = list("Lewis and Clark (Blue Lake) Beach", "KIAWHITI3", as.Date("2018-06-05"), 
                                                88.03, 95.60, 74.80,
                                                43.59, 66, 30,
                                                62.38, 65.20, 59.20,
                                                4.65, 7, 2,
                                                12.88, 18,
                                                0, 29.80, 29.70))
set(weather, 853L, names(weather), value = list("Pike’s Point Beach", "KIAMILFO3", as.Date("2018-07-03"), 
                                                80, 86.7, 68.5, 
                                                77, 87, 67, 
                                                72, 76, 64,
                                                6.2, 13, 0,
                                                12.9, 21,
                                                0, 29.96, 29.86))
set(weather, 1018L, names(weather), value = list("Triboji Beach", "KIAMILFO3", as.Date("2018-07-03"), 
                                                80, 86.7, 68.5, 
                                                77, 87, 67, 
                                                72, 76, 64,
                                                6.2, 13, 0,
                                                12.9, 21,
                                                0, 29.96, 29.86))

temp_F_to_C <- function(x, sig.fig=1){round((x-32)*(5/9),sig.fig)}

set(weather, j = "avg_temp", value = temp_F_to_C(weather$avg_temp))
set(weather, j = "high_temp", value = temp_F_to_C(weather$high_temp))
set(weather, j = "low_temp", value = temp_F_to_C(weather$low_temp))
set(weather, j = "avg_dew", value = temp_F_to_C(weather$avg_dew))
set(weather, j = "high_dew", value = temp_F_to_C(weather$high_dew))
set(weather, j = "low_dew", value = temp_F_to_C(weather$low_dew))
set(weather, j = "avg_wind", value = round(weather$avg_wind/2.237,2))
set(weather, j = "high_wind", value = round(weather$high_wind/2.237,2))
set(weather, j = "low_wind", value = round(weather$low_wind/2.237,2))
set(weather, j = "avg_gust", value = round(weather$avg_gust/2.237,2))
set(weather, j = "high_gust", value = round(weather$high_gust/2.237,2))
set(weather, j = "precip", value = round(weather$precip*2.54,3))

Cyanobacteria

cyanobacteria <- dada2::assignSpecies(classifications[Class == "Cyanobacteria"][[1]], refFasta = '../data/16S_processing/databases/rdp_species_assignment_18.fa.gz', verbose = T)

Phyloseq Object

lake_po <- phyloseq::phyloseq(phyloseq::otu_table(as.matrix(read_counts[,-1]), TRUE),
                              phyloseq::tax_table(as.matrix(classifications)),
                              phyloseq::sample_data(data.frame(unique(merge(metadata, weather,
                                                                     by = c("Date", "Location"),
                                                                     all.x = TRUE))
                                                                     , row.names = 3)))
lake_po
## phyloseq-class experiment-level object
## otu_table()   OTU Table:         [ 70033 taxa and 732 samples ]
## sample_data() Sample Data:       [ 732 samples by 38 sample variables ]
## tax_table()   Taxonomy Table:    [ 70033 taxa by 7 taxonomic ranks ]

Download

Maps

iowa <- readRDS('../data/maps/iowa_terrain_map.RDS')
iowa_bw <- readRDS('../data/maps/iowa_terrain_map_bw.RDS')



Schuyler Smith
Ph.D. Student - Bioinformatics and Computational Biology
Iowa State University. Ames, IA.